package stz.flash;

import net.rim.device.api.system.Application;
import stz.flash.option.app.HomeScreenHotkeyOption;
import blackberry.util.DjPermissions;


public class Launcher extends Application {

	public static void main(String[] args) {

		if (args != null && args.length > 0 && args[0].equals("startup")) {
			initialHotkey();
			new LauncherKeyListener().enterEventDispatcher();
	
		} else {
			if (isDenyPermissions())
				return;
			new MainApp().enterEventDispatcher();
		}
		
	}

	private static void initialHotkey() {
		HomeScreenHotkeyOption.getIns().updateHomeScreenHotkeyWithPersistentData();
	}
	
	private static boolean isDenyPermissions() {
		if (DjPermissions.isDenyPermissions(Info.REQUEST_PERMISSIONS) == false) 
			return false;
		
		DjPermissions.invokePermissionsRequest(Info.REQUEST_PERMISSIONS);
		
		return DjPermissions.isDenyPermissions(Info.REQUEST_PERMISSIONS) ? true : false;
	}
}
